public class Demo3 {
    public static void main(String args[]) {
        int sum = 0;
        int[] array1 = {1,2,3,4,5,6};
        for(int x:array1) {
            sum += x;
        }
        System.out.println("数组的和为："+ sum);
    }
}
